//
//  registerViewController.m
//  07-homeWork周末作业
//
//  Created by 402030900@qq.com on 16/7/22.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import "registerViewController.h"
#import "LoginViewController.h"
@interface registerViewController ()

@end

@implementation registerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    // 背景
    UIImageView *imageBack = [[UIImageView alloc] initWithFrame:self.view.frame];
    imageBack.image = [UIImage imageNamed:@"welcome_2.jpg"];
    [self.view addSubview:imageBack];
    imageBack.alpha = 0.7;
    // 拉钩图标
    UIImageView *lagouImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 150)];
    lagouImage.center = CGPointMake(375 / 2 , 220);
    lagouImage.backgroundColor = [UIColor clearColor];
    [self.view addSubview:lagouImage];
    lagouImage.image = [UIImage imageNamed:@"logo_lagou"];
    //圆角
    UIView *corner = [[UIView alloc] initWithFrame:CGRectMake(10, 320 , 315 + 40, 85)];
    corner.backgroundColor = [UIColor clearColor];
    [self.view addSubview:corner];
    corner.layer.cornerRadius = 5;
    corner.clipsToBounds = YES;
    
    // 手机号
    //图标
    UIImageView *teleImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    teleImage.backgroundColor = [UIColor blackColor];
    [corner addSubview:teleImage];
    teleImage.alpha = 0.7;
    teleImage.image = [UIImage imageNamed:@"tele"];
    //文本框
    UITextField *teleText = [[UITextField alloc] initWithFrame:CGRectMake(40, 0, 375 - 60, 40)];
    teleText.backgroundColor = [UIColor blackColor];
    [corner addSubview:teleText];
    teleText.alpha = 0.4;
    teleText.placeholder = @"请输入手机号";// 为嘛不显示
    
    // 验证码
    // 图标
    UIImageView *securityImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 45, 40, 40)];
    securityImage.backgroundColor = [UIColor blackColor];
    [corner addSubview:securityImage];
    securityImage.alpha = 0.7;
    securityImage.image = [UIImage imageNamed:@"security"];
    // 文本框
    UITextField *securityText = [[UITextField alloc] initWithFrame:CGRectMake(40, 45, 375 - 60, 40)];
    securityText.backgroundColor = [UIColor blackColor];
    [corner addSubview:securityText];
    securityText.alpha = 0.4;
    securityText.placeholder = @"请输入验证码";// 为嘛不显示
    
    // 获取验证码"|"
    UIView *getSecurityLine = [[UIView alloc] initWithFrame:CGRectMake(175, 10, 1, 20)];
    getSecurityLine.backgroundColor = [UIColor lightGrayColor];
    [securityText addSubview:getSecurityLine];
    // 获取验证码Button
    UIButton * getSecurityButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [getSecurityButton setFrame:CGRectMake(176, 0, 140, 40)];
    getSecurityButton.backgroundColor = [UIColor clearColor];
    [securityText addSubview:getSecurityButton];
    [getSecurityButton setTitle:@"获取验证码" forState:(UIControlStateNormal)];
    [getSecurityButton setTitleColor:[UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    getSecurityButton.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    
    // 注册代表你已同意
    // 已同意图标
    UIImageView *agreeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(40, 415, 30, 30)];
    agreeImageView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:agreeImageView];
    agreeImageView.image =[UIImage imageNamed:@"register2"];
    // 已同意Label
    UILabel *agreeLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 415, 140, 40)];
    agreeLabel.backgroundColor = [UIColor clearColor];
    [self.view addSubview:agreeLabel];
    agreeLabel.text = @"注册代表你已同意";
    agreeLabel.textColor = [UIColor whiteColor];
    agreeLabel.textAlignment = NSTextAlignmentLeft;
    agreeLabel.font = [UIFont boldSystemFontOfSize:17];
    //同意拉钩用户协议Button
    UIButton * agreeButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [agreeButton setFrame:CGRectMake(220, 415, 140, 40)];
    agreeButton.backgroundColor = [UIColor clearColor];
    [self.view addSubview:agreeButton];
    [agreeButton setTitle:@"拉钩用户协议" forState:(UIControlStateNormal)];
    [agreeButton setTitleColor:[UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    agreeButton.titleLabel.font = [UIFont boldSystemFontOfSize:17];
    
    // 注册
    UIButton *registerButton = [UIButton buttonWithType:UIButtonTypeSystem];
    registerButton.frame = CGRectMake(10, 472, 375 - 20, 40);
    [registerButton setTitle:@"注册" forState:UIControlStateNormal];
    [self.view addSubview:registerButton];
    registerButton.backgroundColor = [UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:1];
    [registerButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    registerButton.titleLabel.font = [UIFont boldSystemFontOfSize:20]; //加粗
    [registerButton addTarget:self action:@selector(didRegister:) forControlEvents:(UIControlEventTouchUpInside)];
    
    // 返回登录
    UIButton *backLogin = [UIButton buttonWithType:UIButtonTypeSystem];
    [backLogin setFrame:CGRectMake(10, 422 + 60 + 50, 375 - 20, 40)];
    [backLogin setTitle:@"返回登录" forState:UIControlStateNormal];
    [self.view addSubview:backLogin];
    backLogin.backgroundColor = [UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:0.2];
    [backLogin setTitleColor:[UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    backLogin.layer.borderWidth = 3;
    backLogin.layer.borderColor = [UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:1].CGColor;
    backLogin.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [backLogin addTarget:self action:@selector(didBackLogin:) forControlEvents:(UIControlEventTouchUpInside)];
    
    // Do any additional setup after loading the view, typically from a nib.
}
// 注册按钮方法
-(void)didRegister:(UIButton *)button {
    NSLog(@"注册成功");
}
// 返回登录按钮方法
-(void)didBackLogin:(UIButton *)button {
    LoginViewController * loginVC= [[LoginViewController alloc]init];
    [self presentViewController:loginVC animated:YES completion:nil];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
